package com.ruoyi.common.core.domain.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * 系统配置实体类
 *
 * @author yourname
 */
public class SystemConfig extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /** 主键ID */
    private Long id;

    /** 配置项名称 */
    @Xss(message = "配置项名称不能包含脚本字符")
    @NotBlank(message = "配置项名称不能为空")
    @Size(min = 0, max = 50, message = "配置项名称长度不能超过50个字符")
    private String name;

    /** 配置项标题 */
    @Xss(message = "配置项标题不能包含脚本字符")
    @NotBlank(message = "配置项标题不能为空")
    @Size(min = 0, max = 50, message = "配置项标题长度不能超过50个字符")
    private String title;

    /** 表单ID */
    @NotNull(message = "表单ID不能为空")
    private Integer formId;

    /** 配置项值 */
    @Xss(message = "配置项值不能包含脚本字符")
    private String value;

    /** 状态(1:启用 0:禁用) */
    @NotNull(message = "状态不能为空")
    private Integer status;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 表单名称 */
    @Xss(message = "表单名称不能包含脚本字符")
    @Size(min = 0, max = 50, message = "表单名称长度不能超过50个字符")
    private String formName;

    public SystemConfig() {}

    public SystemConfig(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getFormId() {
        return formId;
    }

    public void setFormId(Integer formId) {
        this.formId = formId;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getFormName() {
        return formName;
    }

    public void setFormName(String formName) {
        this.formName = formName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("title", getTitle())
                .append("formId", getFormId())
                .append("value", getValue())
                .append("status", getStatus())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .append("formName", getFormName())
                .toString();
    }
}
